//
//  OurClass.m
//  OC07_作业
//
//  Created by dllo on 15/12/9.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "OurClass.h"
#import "Teacher.h"
#import "Student.h"

@implementation OurClass

- (instancetype)init {
    self = [super init];
    if (self) {
        self.stuArr = [NSMutableArray array];
    }
    return self;
}


- (instancetype)initWithStuArr:(NSMutableArray *)stuArr {
    self = [super init];
    if (self) {
        self.stuArr = [stuArr copy];
    }
    return self;
}



/** 添加学生 */
- (void)addStudent:(Student *)student {
    
    for (Student *stu in self.stuArr) {
        if (stu.number == student.number) {
            return;
        }
    }
    [self.stuArr addObject:student];
}

/** 删除学生 */
- (void)deleteStudent:(NSInteger)number {
    for (Student *stu in self.stuArr) {
        if (stu.number == number) {
            [self.stuArr removeObject:stu];
        }
    }
}




- (void)dealloc {
    [_teacher release];
    [_stuArr release];
    [super dealloc];
}

















@end
